package com.study.d026effect;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.effect.GaussianBlur;
import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Paint;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;

/**添加效果后的坐标转换
*@description
*@author xtayhame
*date 2020年3月21日
*version
*since v1.0
*/
public class GetXYMain extends Application{
	public static void main(String[] args) {
		launch(args);
	}
	@Override
	public void start(Stage stage) throws Exception {
		AnchorPane anchorPane = new AnchorPane();
		Rectangle rc= new Rectangle(100, 100, Paint.valueOf("#8470FF"));

		GaussianBlur gb=new GaussianBlur(10);
		rc.setEffect(gb);

		anchorPane.getChildren().add(rc);
		AnchorPane.setTopAnchor(rc, 100.0);
		AnchorPane.setLeftAnchor(rc, 100.0);
		stage.setScene(new Scene(anchorPane, 500, 400));
		stage.show();

		System.out.println("不添加效果时的宽和高：");
		System.out.println("          "+rc.getWidth() + "--" + rc.getHeight());
		System.out.println("          "+rc.getLayoutBounds());
		System.out.println("          "+rc.getBoundsInLocal());
		System.out.println("          "+rc.getBoundsInParent());

		/**
		 *   100.0--100.0
          BoundingBox [minX:0.0, minY:0.0, minZ:0.0, width:100.0, height:100.0, depth:0.0, maxX:100.0, maxY:100.0, maxZ:0.0]
          BoundingBox [minX:0.0, minY:0.0, minZ:0.0, width:100.0, height:100.0, depth:0.0, maxX:100.0, maxY:100.0, maxZ:0.0]
          BoundingBox [minX:100.0, minY:100.0, minZ:0.0, width:100.0, height:100.0, depth:0.0, maxX:200.0, maxY:200.0, maxZ:0.0]
		 */

		System.out.println("添加效果时的宽和高：");
		System.out.println("          "+rc.getWidth() + "--" + rc.getHeight());
		System.out.println("          "+rc.getLayoutBounds());
		System.out.println("          "+rc.getBoundsInLocal());
		System.out.println("          "+rc.getBoundsInParent());

		/**
		 * 添加效果时的宽和高：
          100.0--100.0
          BoundingBox [minX:0.0, minY:0.0, minZ:0.0, width:100.0, height:100.0, depth:0.0, maxX:100.0, maxY:100.0, maxZ:0.0]
          BoundingBox [minX:-10.0, minY:-10.0, minZ:0.0, width:120.0, height:120.0, depth:0.0, maxX:110.0, maxY:110.0, maxZ:0.0]
          BoundingBox [minX:90.0, minY:90.0, minZ:0.0, width:120.0, height:120.0, depth:0.0, maxX:210.0, maxY:210.0, maxZ:0.0]
		 */

	}
}
